export const hasLogin = (content: string = "需要登录才能访问本页面哟！", goIndex: boolean = true) => {
  const uid = Number(wx.getStorageSync("uid"))
  if (!uid) {
    wx.showModal({
      title: "未登录",
      content: content,
      confirmText: "去登录",
      cancelText: "返回",
      //点击确定和取消触发的都是success函数
      success({ confirm }) {
        if (confirm) {
          wx.navigateTo({
            url: "/pages/login/login",
          })
        } else {
          goIndex
            ? wx.switchTab({
                url: "/pages/index/index",
              })
            : null
        }
      },
    })
    return false
  }
  return true
}
